import http from "@/api";
import { ResPage, Support } from "@/api/interface/index";
import qs from "qs";

//字典类型列表
export const getDictTypeList = (params: Support.DictTypeParams) => {
  return http.post<ResPage<Support.DictType>>(`dictType/list`, qs.stringify(params));
};
//编辑字典类型
export const saveDictType = (params: Support.DictType) => {
  return http.post(`dictType/save`, qs.stringify(params));
};
//删除字典类型
export const delDictType = (params: { ids: number }) => {
  return http.post(`dictType/del`, qs.stringify(params));
};

//字典值列表
export const getDictDataList = (params: Support.DictDataParams) => {
  return http.post<ResPage<Support.DictData>>(`dictData/list`, qs.stringify(params));
};
//编辑字典值
export const saveDictData = (params: Support.DictData) => {
  return http.post(`dictData/save`, qs.stringify(params));
};
//删除字典值
export const delDictData = (params: { ids: number }) => {
  return http.post(`dictData/del`, qs.stringify(params));
};
export const dictDataSelect = (params: { dictType: string }) => {
  return http.post<Support.DictDataSelect>(`dictData/select`, qs.stringify(params));
};

//系统日志列表
export const getOperationLogList = (params: Support.OperationLogParams) => {
  return http.post<ResPage<Support.OperationLog>>(`operationLog/list`, qs.stringify(params));
};

//系统配置列表
export const getConfigList = () => {
  return http.post<Support.Config>(`config/list`);
};
//编辑配置项
export const saveConfig = (params: Support.Config) => {
  return http.post(`config/save`, qs.stringify(params));
};
